package jasongarrett.spida;

import java.util.ArrayList;
import java.util.List;

/**
 * stub out the functionality of the JobApplicationService without making any calls to Spida
 */
public class JobApplicationServiceStub implements JobApplicationService
{

	@Override
	public List<Job> getJobs() throws Exception
	{
		return JobJSONConverter.jobsFromJSON("[{\"position\":\"developer\",\"description\":\"we need someone who can write elegant, well tested code.\",\"_id\":\"5258454d3c32a9e7b1000001\"},{\"position\":\"developer\",\"description\":\"we need someone who can write elegant, well tested code.\",\"_id\":\"525bf964679b4d8fba000001\"}]");
	}

	@Override
	public String createApplication(Application application) throws Exception
	{
		return "5308c6e74e52bcaa00000011";  // application _id
	}

	@Override
	public void deleteApplication(String applicationId) throws Exception
	{
		// do nothing - act like the delete succeeded
	}

	@Override
	public Application getApplication(String applicationId) throws Exception
	{
		Application application = new Application();
		application.setJobId("5258454d3c32a9e7b1000001");
		application.setName("Test Name");
		application.setJustification("Test Justification");
		application.setCode("http://link/to/code");

		List<String> additionalLinks = new ArrayList<String>();
		additionalLinks.add("http://test/additional/link/1");
		application.setAdditionalLinks(additionalLinks);
		
		application.set_id("5308c6e74e52bcaa00000011");
		
		return application;
	}
	
}
